﻿@model Tuple<List<Example4.ShopCode.Dtos.ListSalesDto>, bool>
@{
    ViewData["Title"] = "Shop Stock";
}

@if (!Model.Item1.Any())
{
<h3>No sales found</h3>
}
else
{
    var displayThis = Model.Item2 ? "for shop" + Model.Item1.First().StockItemShopShortName : "(by shop)";

<h3>List Stock @displayThis</h3>
<table class="table">
    <tr>
        @if (!Model.Item2)
            {
        <th>Shop</th>
            }
        <th>Stock name</th>
        <th>Num sold/returned</th>
        <th>Total gain/loss</th>
    </tr>
    @foreach (var stock in @Model.Item1)
        {
    <tr>
        @if (!Model.Item2)
                {
        <td>@stock.StockItemShopShortName</td>
                }
        <td>@stock.StockItemStockName</td>
        <td>@stock.NumSoldReturned</td>
        <td>@(stock.StockItemRetailPrice * stock.NumSoldReturned)</td>
    </tr>
        }
</table>
}